import request from '@/utils/request'

const COURSE_API_PREFIX = '/admin/course'

export default {
  getCoursePage(params) {
    return request({
      url: COURSE_API_PREFIX + '/page',
      method: 'get',
      params
    })
  },
  deleteBatchCourse(ids) {
    return request({
      url: COURSE_API_PREFIX + '/batch',
      method: 'delete',
      data: ids
    })
  },
  deleteCourse(id) {
    return request({
      url: COURSE_API_PREFIX + '/' + id,
      method: 'delete'
    })
  },
  saveCourse(data) {
    return request({
      url: COURSE_API_PREFIX,
      method: 'post',
      data
    })
  },
  getCourseById(id) {
    return request({
      url: COURSE_API_PREFIX + '/' + id,
      method: 'get'
    })
  },
  updateById(id, data) {
    return request({
      url: COURSE_API_PREFIX + '/' + id,
      method: 'put',
      data
    })
  },
  changeStatusById(id, status) {
    return request({
      url: `${COURSE_API_PREFIX}/${id}/${status}`,
      method: 'put'
    })
  },
}
